<template>
	<div class="doingsCard_box">
		<div class="info_box">
			<span>活动类型：{{ cardData.activityTypeName }}</span>
			<span>联系人电话：{{ cardData.activityPhone }}</span>
			<span>开始时间：{{ startTime.substr(0,10) }}</span>
			<span>结束时间：{{ endTime.substr(0,10) }}</span>
			<span>地址：{{ cardData.activityAddress }}</span>
			<span>活动人数：{{ cardData.activityPersonCount }} 人</span>
		</div>
		<div class="info_bottom">
			<!--      <span class="datetime">{{ startTime }}</span>-->
			<span class="datetime"></span>
			<div class="info_tag">
				<div :class="doingState == '已结束'?['state_box','end_state']:['state_box']">
					<span>{{ doingState }}</span>
				</div>
				<span class="score">活动积分+20</span>
			</div>

		</div>
	</div>
</template>

<script>
	import {
		eventDetailsPage
	} from "@/util/publicConfig";
	import {
		baseMixins
	} from "@/util/baseMixins";
	import {
		formatDate
	} from "@/util/timeUtil";

	export default {
		mixins: [baseMixins],
		name: "index",
		props: ['cardData'],
		data() {
			console.log(this);
			return {
				doingState: "进行中",
				eventDetailsPage,
			}
		},
		watch: {
			cardData: {
				handler(newVal, oldVal) {
					let nowTime = Date.now();
					let endTime = Date.parse(newVal.activityEndTime);
					if (nowTime > endTime) {
						this.doingState = "已结束"
					}

				},
				deep: true, // 开启深度监视
				immediate: true
			}
		},
		methods: {},
		computed: {
			startTime() {
				return this.cardData == null || this.cardData.activityStartTime == null || this.cardData
					.activityStartTime === '' ? '' : formatDate(this.cardData.activityStartTime, 'YYYY/MM/DD HH:mm');
			},
			endTime() {
				return this.cardData == null || this.cardData.activityEndTime == null || this.cardData.activityEndTime ===
					'' ? '' : formatDate(this.cardData.activityEndTime, 'YYYY/MM/DD HH:mm');
			}
		}
	}
</script>

<style scoped lang="scss">
	.doingsCard_box {
		width: 100%;
		height: 100%;
		box-sizing: border-box;
		padding-top: 10rpx;
		//padding-left: 31rpx;
		//padding-right: 31rpx;

		.header_box {
			width: 100%;
			height: 110rpx;
			//background-color:yellow;
			display: flex;
			justify-content: space-between;
			align-items: center;

			.title_box {
				width: 60%;
				font-size: 30rpx;
				color: #222222;
				font-weight: 600;
				white-space: nowrap;
				overflow: hidden;
				text-overflow: ellipsis;
			}
		}

		.line_box {
			width: 100%;
			height: 3rpx;
			background-color: #C7C7C7;
		}

		.info_box {
			width: 100%;
			//background-color: pink;
			display: flex;
			flex-direction: column;
			align-items: start;
			justify-content: space-around;
			font-weight: 500;
			color: #707070;
			white-space: nowrap;
			overflow: hidden;
			text-overflow: ellipsis;
			line-height: 2rem;

			span {
				width: 100%;
				overflow: auto;
				overflow-wrap: break-word;
				word-break: break-all;
				white-space: pre-wrap;
			}
		}

		.info_bottom {
			margin-top: 20rpx;
			display: flex;
			justify-content: space-between;
			align-items: flex-end;

			.datetime {
				color: #5e6d82;
				font-size: 0.6rem;
			}

			.score {
				display: block;
				border-radius: 10rpx;
				background: #C10303FF;
				padding: (10rpx 20rpx 10rpx 20rpx);
				font-size: 0.6rem;
				color: white;
				font-weight: 700;
			}

			.info_tag {
				display: flex;
				justify-content: space-between;
				align-items: flex-end;


				.state_box {
					display: block;
					border-radius: 10rpx;
					background: #C10303FF;
					padding: (10rpx 20rpx 10rpx 20rpx);
					font-size: 0.6rem;
					color: white;
					font-weight: 700;
					margin-right: 10rpx
				}

				.end_state {
					background-color: #be978c;
					color: #AD2325;
				}
			}

		}


	}
</style>